
package com.okbihuo.perm.core.tool.config;

import com.okbihuo.perm.core.tool.request.MyRequestFilter;
import lombok.AllArgsConstructor;
import com.okbihuo.perm.core.tool.request.XssProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered;

import javax.servlet.DispatcherType;

/**
 * 过滤器配置类
 *

 */
@Configuration
@AllArgsConstructor
@EnableConfigurationProperties({XssProperties.class})
public class RequestConfiguration {

	private final XssProperties xssProperties;

	/**
	 * 全局过滤器
	 */
//	@Bean
//	public FilterRegistrationBean<MyRequestFilter> xssFilterRegistration() {
//		FilterRegistrationBean<MyRequestFilter> registration = new FilterRegistrationBean<>();
//		registration.setDispatcherTypes(DispatcherType.REQUEST);
//		registration.setFilter(new MyRequestFilter(xssProperties));
//		registration.addUrlPatterns("/*");
//		registration.setName("xssRequestFilter");
//		registration.setOrder(Ordered.LOWEST_PRECEDENCE);
//		return registration;
//	}
}
